/**
 *
 */
package org.text2diagram.nlp.opennlp;

import opennlp.tools.lang.english.TreebankChunker;

import org.text2diagram.nlp.core.NLPDetector;
import org.text2diagram.nlp.core.NLPException;

/**
 * @author alex
 *
 */
public class OpenNLPChunkDetector implements NLPDetector<String[][], String[]> {

    /**
     * English Chunk detector.
     */
    private TreebankChunker chunker;
    /**
     * Instance of English OpenNLP POS tag detector.
     */
    private static OpenNLPChunkDetector instance = new OpenNLPChunkDetector();

    /**
     * Disable default constructor.
     */
    private OpenNLPChunkDetector() {
        super();

        try {
            chunker = new TreebankChunker("resources/models/opennlp/english/chunker/EnglishChunk.bin.gz");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * Get default instance of Engish OpenNLP POS tag detector.
     *
     * @return default instance of Engish OpenNLP POS tag detector.
     */
    public static OpenNLPChunkDetector getInstance() {
        return instance;
    }

	@Override
	public String[] detect(String[][] data) throws NLPException {
		// TODO Auto-generated method stub
		return null;
	}

	/**
	 * Test function.
	 * @param tokens
	 * @param tags
	 * @return
	 * @throws NLPException
	 */
	public String[] detect(String[] tokens, String[] tags) throws NLPException {
		return chunker.chunk(tokens, tags);
	}


}
